package com.gz.logistics.library.pojo;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016-04-27.
 */
public class ClothesPinpai extends CustomerSpinnerObject {
    private int id;
    private String brand;
    private String fabric;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getFabric() {
        return fabric;
    }

    public void setFabric(String fabric) {
        this.fabric = fabric;
    }
    @Override
    public String toString(){
        return brand;
    }
    public static List<ClothesPinpai> parse(JSONArray jsonArray) throws JSONException {
        if (jsonArray == null || jsonArray.length() <= 0){
            return null;
        }
        List<ClothesPinpai> pinpais = new ArrayList<ClothesPinpai>();
        for (int i = 0 ; i < jsonArray.length() ; i ++ ){
            ClothesPinpai info = new ClothesPinpai();
            info.id = (jsonArray.getJSONObject(i)).getInt("id");
            info.brand = (jsonArray.getJSONObject(i)).getString("brand");
            info.fabric = (jsonArray.getJSONObject(i)).getString("fabric");
            pinpais.add(info);
        }
        return pinpais;
    }
}
